package com.yun.blog.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yun.blog.bean.Blog;
import com.yun.blog.bean.Category;
import com.yun.blog.bean.dto.BlogDto;

import java.util.Collection;
import java.util.List;

/**
 * title        : BlogService
 * projectName  : dantouBlog-back
 * description  : TODO
 * author       : simple
 * date         : 2022/11/23下午10:07
 */

public interface BlogService extends IService<Blog> {

    Blog getByBlogId(Integer blogId);

    <P extends IPage<Blog>> P customPage(P page, String searchText, String orderBy);

    <P extends IPage<Blog>> P timelinePage(P page);

    List<Blog> listAllByBlogCategoryId(Integer blogCategoryId);

    List<Blog> listAllByTagId(Integer tagId);

    List<Blog> getByIsTop(Boolean isTop);

    List<Blog> getNewBlogByCount(Integer count);

    int addBlogViews(Integer blogId);

    <P extends IPage<Blog>> P getByCondition(
            P page,
            String searchText,
            Integer categoryId,
            Boolean isTop,
            Collection<Integer> tagIdList,
            String beginCreateTime,
            String endCreateTime,
            String orderBy
    );

    Integer getViewCount();

    Integer getCountByCategory(Category category);

    List<Blog> getViewRank(int count);

    Blog saveOrUpdate(BlogDto blog);

    Blog getPrevious(Integer blogId);

    Blog getNext(Integer blogId);
}
